package com.spzx.user.controller;

import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.user.domain.Region;
import com.spzx.user.domain.UserAddress;
import com.spzx.user.service.RegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.spzx.common.core.web.domain.AjaxResult.success;

@RestController
@RequestMapping("/region")
public class RegionController {

    @Autowired
    private RegionService regionService;

    @Operation(summary = "根据code获取地区名称")
    @GetMapping("/treeSelect/{code}")
    public AjaxResult save(@PathVariable(value = "code") String code) {
        List<Region> region = regionService.getlist(code);
        return success(region);
    }

//    @GetMapping("/treeSelect/{id}")
//    public AjaxResult treeselect(@PathVariable String id){
//        return  success(regionService.treeselect(id));
//    }

}
